/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uloha4.main;

import java.util.ArrayList;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import uloha4.entities.ComponentList;
import uloha4.entities.Node;
import uloha4.parser.GMLParser;
import uloha4.view.View;

/**
 *
 * @author Tomique
 */
public class Main {

	final int WIDTH = 2000;
	final int HEIGHT = 1200;
	final int ITERATIONS = 1500;
	final int TEMPERATURE = 500;
		
    public Main() {
        init();
    }

    private void init() {
        // 1) parsovat vstupni soubor a utvorit graf
        ArrayList<Node> graph = GMLParser.parse("netscience.gml");

        // 2) prevest graf na jednotlive komponenty souvislosti (bez ohledu na orientaci)
        ComponentList components = GraphToolkit.getComponents(graph);

        // 3) usporadat a napozicovat graf
//        GraphLayout.randomLayout(components, WIDTH, HEIGHT);
        GraphLayout.circleLayout(components, WIDTH, HEIGHT);
        
//        GraphLayout.gridLayout(components, WIDTH, HEIGHT);

        GraphLayout.FruchtermanRheingoldLayout(components, WIDTH, HEIGHT, ITERATIONS, TEMPERATURE);
        // 4) vizualizovat graf
        new View();
    }

    public static void main(String[] args) {
        // nastavim styl vykreslovani GUI
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
            System.err.println("The atempt to set system Look&Feel failed. "
                    + "Continuing with default.");
        }

        new Main();
    }
}
